import 'package:gold/base/config.dart';
import 'package:gold/base/list_view_model.dart';
import 'package:gold/model/gold_recover_order_model.dart';
import 'package:gold/route/routes.dart';
import 'package:gold/route/xfg_nav.dart';
import 'package:gold/utils/xfg_extension.dart';

/// @description: 线下订单列表状态
/// @author tangzhentao
/// @created at 21:34 2024/12/14

class OfflineOrderViewmodel extends ListViewModel<GoldRecoverOrderModel> {

  OfflineOrderViewmodel(super.api) {
    isLast = false;
  }

  /// 订单详情
  Future toDetailPage(int index) async {
    final order = list[index];
    if (order.id != null) {
      XfgNav.pushNamed(Routes.myOrderRecoverOfflineDetail, arguments: order);
    } else {
      '无效订单'.info();
    }
  }

  @override
  Map<String, dynamic>? onOtherData() {
    return {"filter": {"method": RecoverType.offline, "status": ''}};
  }
}
